<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
require_once 'database.php';
$username=$_POST["username"];
$password=$_POST["password"];

$retrieve=database::query("SELECT * FROM user WHERE username='$username' AND password='$password'");
$res=  mysql_fetch_array($retrieve);
$user=$res['username'];
$pass=$res['password'];
if(isset($user)){
    setcookie("username",$username,time()+600);
    header("Location:home.php");
}
else{
    echo"login failed,please <a href='login.php'>try again</a>";
}
?>
